package com.hmall.search.mq;


import com.hmall.search.constatnts.MqConstants;
import com.hmall.search.service.SearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HotelListener {
    @Autowired
    private SearchService searchService;


    @RabbitListener(queues = MqConstants.ITEM_INSERT_QUEUE)
    public void listenHotelInsertOrUpdate(Long id){
        searchService.insertById(id);
    }


    @RabbitListener(queues = MqConstants.ITEM_DELETE_QUEUE)
    public void listenHotelDelete(Long id){
        searchService.deleteById(id);
    }
}
